package com.lagou.controller;

import com.lagou.entity.PromotionAd;
import com.lagou.service.AdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *
 */
@RestController
@RequestMapping("ad")
@CrossOrigin //操作解决跨域，那么就不用我们自己配置跨域了，比如添加依赖或者添加配置等等，他是Spring Web依赖自带的
public class AdController {
    @Autowired
    private AdService adService;

    @GetMapping("getAdsBySpaceId/{spaceid}")
    public List<PromotionAd> getAdsBySpaceId(@PathVariable("spaceid") Integer sid){
        List<PromotionAd> list = adService.getAdsBySpaceId(sid);
        return list;
    }
}
